package com.hex.campus.backend.hex_campus_backend.entity;

import java.io.Serializable;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import lombok.Data;

@Data
@Entity
@Table(name = "books")
public class Book implements Serializable{
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(nullable = false)
    private String title; 

    @Column(nullable = false)
    private String price;//价格
    
    @ManyToOne
    @JoinColumn(name = "user_id", nullable = false)
    private User user; // 卖家，与 User 建立多对一关系

    @Column(nullable = false)
    private String description; // 教材描述（新旧程度如何，内容是什么、使用于什么课程等）

    @Column(nullable = true)
    private String imageUrl; // 图片的存储路径或 URL
}